#include <bits/stdc++.h>
#define maxn 505050
#define maxm 1010100
using namespace std;

queue<int> q;
vector<pair<int, int>> ans;
vector<int>mp[maxn];
int n, m;

int deg[maxn];
bool vis[maxn];

int main()
{
    int n, m;
    scanf("%d%d", &n, &m);
    for (int i = 1, u, v; i <= m; i++) {
        scanf("%d%d", &u, &v);
        mp[u].push_back(v);
        mp[v].push_back(u);
        deg[u]++, deg[v]++;
    }
    for (int i = 1; i <= n; i++) {
        if (deg[i] == 1)
            vis[i] = true, q.push(i);
    }
    while (!q.empty()) {
        int u = q.front();
        q.pop();
        for (int v : mp[u]) {
            deg[v]--;
            if (deg[v] == 1 && !vis[v])
                vis[v] = true, q.push(v);
        }
    }
    memset(vis, false, sizeof(vis));
    for (int i = 1; i <= n; i++) {
        if (deg[i] > 1)
            vis[i] = true, q.push(i);
    }
    while (!q.empty()) {
        int u = q.front();
        q.pop();
        for (int v : mp[u]) {
            if (!vis[v])
                vis[v] = 1, q.push(v);
        }
    }
    for (int u = 1; u <= n; u++) 
        for (int v : mp[u]) 
            if ((!vis[u] && mp[u].size() == 1) || (vis[u] && deg[u] > 1 && deg[v] == 1))
                ans.push_back(make_pair(u, v));
    sort(ans.begin(), ans.end());
    printf("%d\n", ans.size());
    for (pair<int, int> x : ans) 
        printf("%d %d\n", x.first, x.second);
    return 0;
}